package com.wangchao.administrator.zenmechi.ui.fragment.shopfragment;

import com.wangchao.administrator.zenmechi.bean.categorybean.CategoryBean;
import com.wangchao.administrator.zenmechi.bean.shopcategorybean.ShopCategoryBean;
import com.wangchao.administrator.zenmechi.http.HttpHelper;

import java.util.Map;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by Administrator on 2016/10/19.
 */
public class ShopFragmentModel implements ShopFragmentContract.Model {
    @Override
    public void getCategoryData(Map<String, String> map,
                                Subscriber<ShopCategoryBean> subscriber) {
        HttpHelper.getInstance().getCategory(map)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(subscriber);
    }

    @Override
    public void getCateList(Map<String, String> map, Subscriber<CategoryBean> subscriber) {
        //Log.i("tag","----------"+map.toString());
        HttpHelper.getInstance().getCateList(map)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.io())
                .subscribe(subscriber);
    }
}
